class_name Player
extends Node
@onready var health_component: HealthComponent = $HealthComponent
@onready var state_machine: StateMachine = $StateMachine


signal player_shoot

var enemy

func _ready() -> void:
	add_to_group("Player")
	#print(health_component.get_health())
	#health_component.health_changed.connect(_on_health_component_health_changed)
	#health_component.died.connect(_on_health_component_died)
	var enemys = get_tree().get_nodes_in_group("Enemy")
	if enemys.size() > 0:
		enemy = enemys[0]
		
	enemy.enemy_shoot.connect(_on_enemy_shoot)
func _input(event: InputEvent) -> void:
	pass

#region 信号链接相关函数

func _on_enemy_shoot() ->void:
	state_machine.transition_to("Hurt")

func _on_health_component_died() -> void:
	pass # Replace with function body.

func _on_health_component_health_changed(old_value: float, new_value: float) -> void:
	pass # Replace with function body.

#endregion
